/*     */ package org.jasig.services.persondir.support.jdbc;
/*     */ 
/*     */ import java.util.ArrayList;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import javax.sql.DataSource;
/*     */ import org.jasig.services.persondir.IPersonAttributes;
/*     */ import org.jasig.services.persondir.support.CaseInsensitiveAttributeNamedPersonImpl;
/*     */ import org.jasig.services.persondir.support.CaseInsensitiveNamedPersonImpl;
/*     */ import org.jasig.services.persondir.support.MultivaluedPersonAttributeUtils;
/*     */ import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
/*     */ 
/*     */ public class SingleRowJdbcPersonAttributeDao extends AbstractJdbcPersonAttributeDao<Map<String, Object>>
/*     */ {
/*  69 */   private static final ParameterizedRowMapper<Map<String, Object>> MAPPER = new ColumnMapParameterizedRowMapper(true);
/*     */ 
/*     */   public SingleRowJdbcPersonAttributeDao(DataSource ds, String sql)
/*     */   {
/*  79 */     super(ds, sql);
/*     */   }
/*     */ 
/*     */   protected ParameterizedRowMapper<Map<String, Object>> getRowMapper()
/*     */   {
/*  87 */     return MAPPER;
/*     */   }
/*     */ 
/*     */   protected List<IPersonAttributes> parseAttributeMapFromResults(List<Map<String, Object>> queryResults, String queryUserName)
/*     */   {
/*  96 */     List peopleAttributes = new ArrayList(queryResults.size());
/*     */ 
/*  98 */     for (Map queryResult : queryResults) {
/*  99 */       Map multivaluedQueryResult = MultivaluedPersonAttributeUtils.toMultivaluedMap(queryResult);
/*     */       IPersonAttributes person;
/*     */      
/* 102 */       if (queryUserName != null) {
/* 103 */         person = new CaseInsensitiveNamedPersonImpl(queryUserName, multivaluedQueryResult);
/*     */       }
/*     */       else
/*     */       {
/* 107 */         String userNameAttribute = getConfiguredUserNameAttribute();
/* 108 */         person = new CaseInsensitiveAttributeNamedPersonImpl(userNameAttribute, multivaluedQueryResult);
/*     */       }
/*     */ 
/* 111 */       peopleAttributes.add(person);
/*     */     }
/*     */ 
/* 114 */     return peopleAttributes;
/*     */   }
/*     */ }

/* Location:           C:\Users\Administrator\Desktop\person-directory-impl-1.5.1.jar
 * Qualified Name:     org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao
 * JD-Core Version:    0.6.2
 */